package com.lwb.ztx.news.widget;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import com.lwb.ztx.utils.ListUtils;

import java.util.List;

/**
 * Created by Administrator on 2016/5/28.
 */
public class NewsSliderAdapter extends FragmentPagerAdapter {
    List<Fragment> fragments;

    public NewsSliderAdapter(FragmentManager fm) {
        super(fm);
    }
    public NewsSliderAdapter(FragmentManager fm,List<Fragment> fragments) {
        super(fm);
        this.fragments = fragments;
    }

    public void setFragments(List<Fragment> fragments) {
        this.fragments = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return ListUtils.getSize(fragments);
    }
}
